/**
 * ${comment}
 * @author ${author}
 * @date ${date}
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
import { <#if imports.baseEntity??>${imports.baseEntity}, </#if>IConfigSchema } from '@/soar';
import { basePath } from './api';
import { MenuComponent } from '@/types/interface';

export interface ${modelName}<#if imports.baseEntity??> extends ${imports.baseEntity}</#if> {
<#list wl as x>
  /** ${x.label} */
  ${x.field}?: any;
</#list>
}

const fieldList: IConfigSchema<${modelName}>[] = [
<#list wl as x>
  <#if x.enabled>
  {
    field: '${x.field}',
    label: '${x.label}',
    dataType: '${x.dataType}',
    <#if x.params??>
    params: ${x.params}
    </#if>
    <#if x.table??>
    table: ${x.table}
    </#if>
    <#if x.search??>
    search: ${x.search}
    </#if>
    <#if x.form??>
    form: ${x.form}
    </#if>
    <#if x.detail??>
    detail: ${x.detail}
    </#if>
  },
  </#if>
</#list>
];

export default fieldList;

/**
* 组件配置（用于生成菜单数据）
*/
export const COMPONENTS: MenuComponent[] = [
  {
    title: '${comment}',
    component: () => import('./List.vue'),
    sort: 0,
    keepalive: true,
    icon: '',
<#noparse>
    permits: [`GET${basePath}/query`],
    elements: [
      { title: '新增', code: 'create', permits: [`POST${basePath}/create`] },
      { title: '更新', code: 'update', permits: [`POST${basePath}/update`, `GET${basePath}/detail`] },
      { title: '删除', code: 'remove', permits: [`POST${basePath}/remove`] },
      { title: '详情', code: 'detail', permits: [`GET${basePath}/detail`] },
      { title: '导入', code: 'import', permits: [`POST${basePath}/import`] },
      { title: '导出', code: 'export', permits: [`GET${basePath}/export`] },
    ],
  },
</#noparse>
];